


<div id="element-box">	
	<div class="m">
		<div class="subNav">
			<ul>
				<li class="active">
					<div>
						<a title="" href="/admin/category/index"><?php echo $this->translate('admin_category_index_tab')?></a>
					</div>
				</li>
				<li >
					<div>
						<a title="" href="/admin/category/add"><?php echo $this->translate('admin_category_add_tab')?></a>						
					</div>
				</li>				
			</ul>
		</div>		
		<?php echo $this->message; ?>
		<div class="head-title">
			<h3>
				<span>Quản lý danh mục / Danh sách</span>
			</h3>			
		</div>	

		<form method="post" action="" name="adminForm" id="adminForm">
			<fieldset id="filter-bar">
				<div class="filter-search fltlft">
					<label for="filter_keyword" class="filter-search-lbl"><?php echo $this->translate('admin_form_filter_keyword')?>: </label>
					<input type="text" title="Search" style="width: 200px"  id="filter_keyword" name="filter_keyword"
						 value="<?php echo isset($this->filterKeyword) ? $this->filterKeyword : '' ?>">
					<button type="submit">Search</button>
					<button
						onclick="document.id('filter_search').value='';this.form.submit();"
						type="button">Clear</button>
				</div>

				<div class="filter-select fltrt">					
					<select onchange="this.form.submit()" class="inputbox" name="filter_active">
						<option value="*"><?php echo $this->translate('admin_form_filter_published')?></option>
						<option <?php echo (isset($this->filterActive) && $this->filterActive === '1') ? 'selected="selected"' : ''; ?> value="1">
							<?php echo $this->translate('admin_form_published')?></option>
						<option <?php echo (isset($this->filterActive) && $this->filterActive === '0') ? 'selected="selected"' : ''; ?> value="0">
							<?php echo $this->translate('admin_form_unpublished')?></option>	
					</select> 				
				</div>
			</fieldset>
			<table class="adminlist">
				<thead>
					<tr>
						<th width="1%"><input type="checkbox"
							onclick="jForm.checkAll(this)" title="Check All" value=""
							name="checkall-toggle">
						</th>
						<th><?php echo $this->translate('admin_table_title')?></th>
						<th width="7%"><?php echo $this->translate('admin_table_status')?></th>						
						<th width="12%"><?php echo $this->translate('admin_table_modified_date')?></th>
						<th width="12%"><?php echo $this->translate('admin_table_created_by')?></th>						
						<th width="120" class="nowrap"><?php echo $this->translate('admin_table_action')?></th>
					</tr>
				</thead>
	
				<tbody>
					<?php
					$row = true; 
					foreach ($this->arrCat as $item) {
					?>
						<tr class="row<?php echo ($row) ? 0 : 1?>">
							<td class="center">
								<input type="checkbox" value="<?php echo $item['id']?>" name="cid[]" id="cb0">
							</td>							
							<td>
								<?php 
									$beforeTitle = $beforeAlias = '';
									if (isset($item['level'])) {
										for ($idx = 0; $idx < intval($item['level']- 1) ; $idx++) {
											$beforeTitle .= '<span class="gi">|—</span>';
											$beforeAlias .= '<span class="gtr">|—</span>';
										}
									}
								?>
								<?php echo $beforeTitle?>
								<a href="#"><b><?php echo $item['title']?></b></a>
								<p title="sample-data-articles" class="smallsub">
									<?php echo $beforeAlias?>
									(<span>Alias</span>: <?php echo $item['alias']?>)
								</p>
							</td>
							<td class="center">
								<?php 
								$class = 'unpublish';
								$linkActive = '/admin/category/publish/id/'.$item['id'];
								if (isset($item['active']) && $item['active'] == 1) {
									$class = 'publish';
									$linkActive = '/admin/category/unpublish/id/'.$item['id'];
								}
								?>
								<a class="jgrid" href="<?php echo $linkActive?>"><span class="state <?php echo $class?>"><span class="text"></span></span></a>
							</td>							
							<td class="center"><?php echo date('d/m/Y H:i:s', strtotime($item['created_time']))?></td>
							<td class="center"><?php echo isset($this->arrUser[$item['created_by']]) ? $this->arrUser[$item['created_by']]['username'] : 'Unknow'?></td>							
							<td class="center">
								<a class="btnUpdate" href="/admin/category/edit/id/<?php echo $item['id']?>" title="<?php echo $this->translate('admin_table_action_edit')?>">
									<?php echo $this->translate('admin_table_action_edit')?>
								</a>
								<a class="btnUpdate" href="/admin/category/delete/id/<?php echo $item['id']?>" title="<?php echo $this->translate('admin_table_action_delete')?>">
									<?php echo $this->translate('admin_table_action_delete')?>
								</a>
							</td>
						</tr>
					<?php 
						$row = !$row;
					} 
					?>	
				</tbody>
			</table>	
		</form>
	</div>
</div>